import request from '@/utils/request'

// 根据ID获取报检单
export function getInspectionInfo(id)
{
    return request({
        url: `/api/Business/inspection/${id}`,
        method: 'get'
    });
}

// 获取报检单列表
export function getInspectionList(query)
{
    return request({
        url: `/api/Business/inspection`,
        method: 'GET',
        data: query
    });
}

// 创建报检单
export function createInspection(dataForm)
{
    return request({
        url: `/api/Business/inspection`,
        method: 'post',
        data: dataForm,
    });
}

// 更新报检单
export function updateInspection(dataForm)
{
    return request({
        url: `/api/Business/inspection/${dataForm.id}`,
        method: 'put',
        data: dataForm,
    });
}

// 删除报检单
export function deleteInspection(id)
{
    return request({
        url: `/api/Business/inspection/${id}`,
        method: 'delete',
    });
}

// 根据ID批量删除报检单
export function batchDeleteInspection(ids)
{
    return request({
        url: `/api/Business/inspection/batchRemove`,
        method: 'POST',
        data: ids,
    });
}


// 确认报检单
export function confirmInspection(id)
{
    return request({
        url: `/api/Business/inspection/Confirm/${id}`,
        method: 'post'
    });
}

// 批量确认报检单
export function batchConfirmInspections(ids)
{
    return request({
        url: `/api/Business/inspection/BatchConfirm`,
        method: 'post',
        data: ids
    });
}

// 报检单合批
export function combineBatchInspections(ids)
{
    return request({
        url: `/api/Business/inspection/CombineBatch`,
        method: 'post',
        data: ids
    });
}

// 根据查询条件导出数据
export function exportData(query)
{
    return request({
        url: `/api/Business/inspection/Actions/Export`,
        method: 'get',
        data: query
    });
}

// 导入
export function ImportData(data)
{
    return request({
        url: '/api/Business/inspection/ImportData',
        method: 'post',
        data
    });
}

// 导入预览
export function ImportPreview(data)
{
    return request({
        url: '/api/Business/inspection/ImportPreview',
        method: 'get',
        data
    });
}

// 模板下载
export function TemplateDownload()
{
    return request({
        url: '/api/Business/inspection/TemplateDownload',
        method: 'get'
    });
}

export default {
    getInspectionInfo,
    getInspectionList,
    createInspection,
    updateInspection,
    deleteInspection,
    batchDeleteInspection,
    confirmInspection,
    batchConfirmInspections,
    combineBatchInspections,
    exportData,
    ImportData,
    ImportPreview,
    TemplateDownload
};
